﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyWorkBlogDAL
{
   public class BlogDB
    {
       private static readonly MyWorkModelContainer _context = new MyWorkModelContainer();
       public static MyWorkModelContainer Context { get { return _context; } }

       private static readonly DbSet<Blog> _Blogs = Context.Blogs;
       private static readonly DbSet<Blogroll> _Blogrolls = Context.Blogrolls;
       private static readonly DbSet<BlogPost> _BlogPosts = Context.BlogPosts;
       private static readonly DbSet<Comment> _Comments = Context.Comments;
       private static readonly DbSet<Reply> _Replies = Context.Replies;
       private static readonly DbSet<ErrorTable> _ErrorTables = Context.ErrorTables;

       public static DbSet<Blog> Blogs { get { return _Blogs; } }
       public static DbSet<Blogroll> Blogrolls { get { return _Blogrolls; } }
       public static DbSet<BlogPost> BlogPosts { get { return _BlogPosts; } }
       public static DbSet<Comment> Comments  { get { return _Comments; } }
       public static DbSet<Reply> Replies  { get { return _Replies; } }
       public static DbSet<ErrorTable> ErrorTables  { get { return _ErrorTables; } }

       public static int Save()
       {
           return Context.SaveChanges();
       }

    }
}
